Introduction to Quarto pt.2

Valeria Duran

2023-11-30

What is Quarto?

  • Quarto is an open-source scientific and technical publishing system built on Pandoc (CL interface, not an R package)
  • Next generation version of R Markdown from Posit
  • Multi-language: R, Python, Julia, Observable JS
  • Authoring tools: RStudio IDE, VSCode, JupyterLab
    • Integration with Jupyter enables use of additional languages
  • Can render most existing Rmd files
  • Has many outputs: publications, books, websites, dashboards

Why is this cool?

  • Git integration
    • GitHub Actions allows for Continuous Integration on GitHub
  • Interactive/dynamic content
  • Single product! Quarto combines many functionalities, leading to fewer dependencies to render reports
  • Figure and table cross references work in word doc (previously not possible with R Markdown)
  • Multilingual team… standardize reports
  • Document templates can be created as Quarto extensions
    • Don’t have to build an R package to share the template
    • Can be language-agnostic
    • Works with presentations if we’re not using any R code!

Interactive Code


```{r}
#| label: "ggplot-example"
#| code-line-numbers: "5-9"

library(ggplot2)
library(plotly)
library(gapminder)

p <- gapminder %>%
  filter(year==1977) %>%
  ggplot( aes(gdpPercap, lifeExp, size = pop, color=continent)) +
  geom_point() +
  theme_bw()

ggplotly(p)


```
library(ggplot2)
library(plotly)
library(gapminder)

p <- gapminder %>%
  filter(year==1977) %>%
  ggplot( aes(gdpPercap, lifeExp, size = pop, color=continent)) +
  geom_point() +
  theme_bw()

ggplotly(p)

Conclusion

  • RStudio v2022.07 and later includes support for editing and preview of Quarto documents
  • Can use multiple languages in one document (think of {reticulate} for R Python)
  • Can use one document for multiple outputs (html, pdf, word, ppt)
  • Quarto extensions makes it easy to create document templates that can be used across platforms

Resources